# from typing import Type, Generic, TypeVar, List, get_args, get_origin, Any, Dict,
# from pydantic import BaseModel
# from pydantic.generics import GenericModel
#
# K = TypeVar('K')
# T = TypeVar('T')
#
#
# class _DictMode(GenericModel, Generic[K, T]):
#     values: Dict[K, T]
#
#
# model = dict[str, int]
#
# print(type(mget_origin(model), get_args(model))

#
# from common.third_party.save_config import load_config, save_config
# from services.server_integration.schemas.alarms import Alarm
# from typing import Tuple
#
# alarm = Alarm(aid=11, code=44, name='TestAlarm', value=55.0, start_value=55.0)
#
# save_config('test/test', {'a': (alarm, None)})
#
#
# alarms = load_config('test/test', dict[str, Tuple[Alarm | None, Alarm | None]], None)
# print(alarms)

#
# import asyncio
# import aiohttp
# from services.server_integration.schemas.alarms import Alarm, ServerAlarm
#
# async def reset_server_current_alarms():
#     server_address = '10.16.0.140:5001'
#     current_alarms = [
#         Alarm(code=1, start_value=1.0, value=1.0, staate=True, aid=11),
#         Alarm(code=5, start_value=22.0, value=22.0, staate=True, aid=12),
#         # Alarm(code=7, start_value=333.0, value=333.0, staate=True, aid=13)
#     ]
#     try:
#         sim_ip = '1.1.1.2'
#         current_alarms = [
#             ServerAlarm.from_alarm(
#                 alarm,
#                 sim_ip,
#                 'd0ded0de-d0de-d0de-d0de-d0ded0ded0de'
#             ).dict()
#             for alarm in filter(lambda x: x is not None, current_alarms)
#         ]
#
#         uri = f'http://{server_address}/alarms/set-not-send-alarms/'
#         async with aiohttp.request(
#                 'POST', uri,
#                 json=current_alarms
#         ) as response:
#             if response.status == 200:
#                 return True
#             else:
#                 return False
#
#     except Exception as e:
#         return False
#
# async def main():
#     print(
#         await reset_server_current_alarms()
#     )
#
#
#
#
# asyncio.run(main())

# import asyncio
# import aiohttp
# from aiosseclient import aiosseclient
#
# async def main():
#     async for event in aiosseclient('http://10.16.0.201/server_integration/calibrate_status'):
#         print(event)
#
#     print('end')
#
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())